#ifndef _VECTOR_FIELD_H_

#define _VECTOR_FIELD_H_

#include "field.h"

namespace pavan {

template <class itype , class dtype , int dim , int N >
  class vectorPointField : public field<itype,dtype,dim> {
  public:
    vectorPointField( grid<itype,dtype,dim> &G , const char *name ) :
       field<itype,dtype,dim>( G , name ) {
      /// Get access to all blocks of the grid
      DECL_BLOCK_VEC( itype , dtype , dim ) &blks = 
        const_cast<DECL_BLOCK_VEC( itype , dtype , dim ) &>(G.getAllBlocks());
      /// Allocate room for the total number of blocks in the grid
      std::cout << "Allocating vector variable " << this->_name
                << " with " << blks.size() << " blocks\n";
      _data.resize( blks.size() );
      /// Within each block allocate room for variable storage
      for( itype iblk = 0 ; iblk < _data.size() ; ++iblk ) {
        _data[iblk].resize( blks[iblk].getExtent() );
        std::cout << blks[iblk].getExtent() << "\n";
      }
    }

    const DECL_VECTOR_DATA( dtype , dim , N ) &data() {
      return 
        reinterpret_cast
          < 
            const DECL_VECTOR_DATA( dtype , dim , N ) &
          >(_data);
 

    }
  private:
    DECL_VECTOR_DATA( dtype , dim , N ) _data;
};

}


#endif
